# -*- coding:utf-8 -*-
class Solution:
    # array 二维列表
    def Find(self, target, array):
        height = len(array)
        width = len(array[0])
        row = 0
        mid = width-1
        while(row != height):
            left = 0
            right = mid
            mid = int((left+right) / 2)
            while( left <= right):
                if target < array[row][mid]:
                    right = mid -1
                    mid = int((right+left)/2)
                elif target > array[row][mid]:
                    left = mid + 1
                    mid = int((left+right) / 2)
                else:
                    return True
            row+=1
        return False